from django import shortcuts
from django import template

def render_to_response(template_name, request, data_dict={}):
  """A wrapper for Django's render_to_response that automatically builds
  a RequestContext to include the default context processors.
  """
  if request is None:
    raise Exception(
      "Request must be provided to use core.utils.render_to_response. "
      "If you want to render a template without a RequestContext, use "
      "django.shortcuts.render_to_response directly."
    )
  return shortcuts.render_to_response(
    template_name, data_dict, context_instance=template.RequestContext(request)
  )